package SoftwareTesting.Pages;

import SoftwareTesting.Constants;
import org.apache.commons.logging.Log;
import org.openqa.selenium.By;


public class LoginPage extends BasicPage{

    public LoginPage(){
        pageUrl = Constants.LoginPageUrl;
        title = Constants.LoginPageTitle;
    }
    public void login() throws InterruptedException {
        login(Constants.CorrectUserName,Constants.CorrectPassWord);
    }
    public void login(String username, String password) throws InterruptedException {
        verify();
        driver.findElement(By.cssSelector(".el-form-item:nth-child(1) .el-input__inner")).clear();
        driver.findElement(By.cssSelector(".el-form-item:nth-child(1) .el-input__inner")).sendKeys(username);
        driver.findElement(By.cssSelector(".el-form-item:nth-child(2) .el-input__inner")).clear();
        driver.findElement(By.cssSelector(".el-form-item:nth-child(2) .el-input__inner")).sendKeys(password);
        driver.findElement(By.cssSelector(".el-button")).click();
        Thread.sleep(Constants.timeout);
    }

    @Override
    public void moveTo() {}
}
